From b8477f0215dce1b63da8e13124f41fcfc0379a41 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 6 Dec 2005 15:52:15 +0100 Subject: [PATCH] Fix the request size for a full page-sized skbuff in netfront driver (must allow 16 bytes for dev_alloc_skb headroom). Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 602cec9ae7..5fd59bc9f5 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -535,8 +535,12 @@ static void network_alloc_rx_buffers(struct net_device *dev) */ batch_target = np->rx_target - (req_prod - np->rx.rsp_cons); for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) { + /* + * Subtract dev_alloc_skb headroom (16 bytes) and shared info + * tailroom then round down to SKB_DATA_ALIGN boundary. + */ skb = alloc_xen_skb( - (PAGE_SIZE - sizeof(struct skb_shared_info)) & + (PAGE_SIZE - 16 - sizeof(struct skb_shared_info)) & (-SKB_DATA_ALIGN(1))); if (skb == NULL) break; -- 2.30.2